/**
 * Created by FengJZ on 2014/5/23.
 */
var ioc = {
    dataSource: {
        type: "org.apache.commons.dbcp.BasicDataSource",
        events: {
            depose: 'close'
        },

        // fields: {
        //    driverClassName: 'com.mysql.jdbc.Driver',
        //    url: 'jdbc:mysql://139.224.210.183:3306/tcmc?characterEncoding=utf8',
        //    username: 'tcmc',
        //    password: 'tcmc'
        // }

        // 阿里云服务器
        fields: {
            driverClassName: 'com.mysql.jdbc.Driver',
            url: 'jdbc:mysql://localhost:3306/tcmc?characterEncoding=utf8',
            username: 'root',
            password: 'zhangjunzhang'
        }

    },
    dao: {
        type: "org.nutz.dao.impl.NutDao",
        args: [
            { refer: "dataSource" }
        ]
    },

    //by add 白义顺 2015-01-23；
    utils : {
        type : 'net.telesing.tcmc.core.Utils',
        fields : {
            sc : {app:'$servlet'}   // 将 ServletContext 对象注入 Utils
        }
    },
    tmpFilePool : {
        type : 'org.nutz.filepool.NutFilePool',     // 临时文件最大个数为 1000 个
        args : [ {java:'$utils.getPath("")'}, 1000 ]
    },
    imageUploadFileContext : {
        type : 'org.nutz.mvc.upload.UploadingContext',
        singleton : false,
        args : [ { refer : 'tmpFilePool' } ],
        fields : {
            // 是否忽略空文件, 默认为 false
            ignoreNull : true,
            // 单个文件最大尺寸(大约的值，单位为字节，即 1048576 为 1M)
            maxFileSize : 20971520         // 正则表达式匹配可以支持的文件名(20M)
            //nameFilter : '^(.+[.])(zip|jpg|png|rar|apk)$'
        }
    },
    imageUpload : {
        type : 'org.nutz.mvc.upload.UploadAdaptor',
        singleton : false,
        args : [ { refer : 'imageUploadFileContext' } ]
    }
};
